﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Admission.aspx.cs" Inherits="_Default" MasterPageFile="~/Admin/Administrator.master" Title = "Administrator Page"%>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent" >
    <p>
         <dx:ASPxGridView ID="gvwAdmission" runat="server" AutoGenerateColumns="False" 
             CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" 
             DataSourceID="Main" Width="100%" KeyFieldName="AdmissionID" 
             onrowvalidating="gvwAdmission_RowValidating">
             <Columns>
                 <dx:GridViewCommandColumn VisibleIndex="0">
                     <EditButton Visible="True">
                     </EditButton>
                     <NewButton Visible="True">
                     </NewButton>
                     <DeleteButton Visible="True">
                     </DeleteButton>
                     <UpdateButton Text="Save">
                     </UpdateButton>
                     <ClearFilterButton Visible="True">
                     </ClearFilterButton>
                 </dx:GridViewCommandColumn>
                 <dx:GridViewDataComboBoxColumn FieldName="StudentID" VisibleIndex="2">
                     <PropertiesComboBox DataSourceID="StudentID" TextField="StudentID" 
                         ValueField="StudentID">
                     </PropertiesComboBox>
                 </dx:GridViewDataComboBoxColumn>
                 <dx:GridViewDataComboBoxColumn FieldName="ClassID" VisibleIndex="3">
                     <PropertiesComboBox DataSourceID="ClassID" TextField="ClassID" 
                         ValueField="ClassID">
                     </PropertiesComboBox>
                 </dx:GridViewDataComboBoxColumn>
                 <dx:GridViewDataComboBoxColumn FieldName="CourseID" VisibleIndex="4">
                     <PropertiesComboBox DataSourceID="CourseID" TextField="CourseID" 
                         ValueField="CourseID">
                     </PropertiesComboBox>
                 </dx:GridViewDataComboBoxColumn>
                 <dx:GridViewDataDateColumn FieldName="Admission_Date" VisibleIndex="5">
                 </dx:GridViewDataDateColumn>
                 <dx:GridViewDataCheckColumn FieldName="Achieve" VisibleIndex="6">
                 </dx:GridViewDataCheckColumn>
             </Columns>
             <SettingsEditing PopupEditFormWidth="600px" />
             <Settings ShowFilterRow="True" ShowTitlePanel="True" />
             <SettingsText Title="Admission Management" />
             <Images SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                 <LoadingPanelOnStatusBar Url="~/App_Themes/DevEx/GridView/StatusBarLoading.gif">
                 </LoadingPanelOnStatusBar>
                 <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                 </LoadingPanel>
             </Images>
             <ImagesFilterControl>
                 <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                 </LoadingPanel>
             </ImagesFilterControl>
             <Styles CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx">
                 <Header ImageSpacing="5px" SortingImageSpacing="5px">
                 </Header>
                 <LoadingPanel ImageSpacing="5px">
                 </LoadingPanel>
             </Styles>
             <StylesEditors ButtonEditCellSpacing="0">
                 <ProgressBar Height="21px">
                 </ProgressBar>
             </StylesEditors>
         </dx:ASPxGridView>
    </p>
    <asp:SqlDataSource ID="Main" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Institte_of_Fine_ArtsConnectionString %>" 
        SelectCommand="SELECT AdmissionID, StudentID, ClassID, CourseID, Admission_Date, Achieve FROM Admission_Details" 
        DeleteCommand="DELETE FROM Admission_Details WHERE (AdmissionID = @AdmissionID)" 
        InsertCommand="INSERT INTO Admission_Details(StudentID, ClassID, CourseID, Admission_Date, Achieve) VALUES (@StudentID, @ClassID, @CourseID, @Admission_Date, @Achieve)" 
        
        UpdateCommand="UPDATE Admission_Details SET StudentID = @StudentID, ClassID = @ClassID, CourseID = @CourseID, Admission_Date = @Admission_Date, Achieve = @Achieve WHERE (AdmissionID = @AdmissionID)">
        <DeleteParameters>
            <asp:Parameter Name="AdmissionID" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="StudentID" />
            <asp:Parameter Name="ClassID" />
            <asp:Parameter Name="CourseID" />
            <asp:Parameter Name="Admission_Date" />
            <asp:Parameter Name="Achieve" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="StudentID" />
            <asp:Parameter Name="ClassID" />
            <asp:Parameter Name="CourseID" />
            <asp:Parameter Name="Admission_Date" />
            <asp:Parameter Name="Achieve" />
            <asp:Parameter Name="AdmissionID" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="StudentID" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Institte_of_Fine_ArtsConnectionString %>" 
        SelectCommand="SELECT [StudentID] FROM [Student]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="ClassID" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Institte_of_Fine_ArtsConnectionString %>" 
        DeleteCommand="DELETE FROM [Class] WHERE [ClassID] = @ClassID" 
        InsertCommand="INSERT INTO [Class] ([ClassID]) VALUES (@ClassID)" 
        SelectCommand="SELECT [ClassID] FROM [Class]">
        <DeleteParameters>
            <asp:Parameter Name="ClassID" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="ClassID" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="CourseID" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Institte_of_Fine_ArtsConnectionString %>" 
        DeleteCommand="DELETE FROM [Course] WHERE [CourseID] = @CourseID" 
        InsertCommand="INSERT INTO [Course] ([CourseID]) VALUES (@CourseID)" 
        SelectCommand="SELECT [CourseID] FROM [Course]">
        <DeleteParameters>
            <asp:Parameter Name="CourseID" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="CourseID" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <br />
    <br />
</asp:Content>